package com.gpnu7_412.yanzhi.service.impl;

import com.gpnu7_412.yanzhi.entity.User;
import com.gpnu7_412.yanzhi.exception.custom.SQLExecuteException;
import com.gpnu7_412.yanzhi.mapper.UserMapper;
import com.gpnu7_412.yanzhi.service.ManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ManagementServiceImpl implements ManagementService {
    @Autowired
    UserMapper userMapper;

    @Override
    public List<User> getAllUsers() {
        List<User> userList = userMapper.selectAllUser();
        if(userList == null || userList.isEmpty()){
            throw new SQLExecuteException("信息获取异常");
        }
        return userList;
    }
}
